﻿@{
    ViewBag.Title = "_ShareDialog";
}
      <script src="@Url.Content("~/Scripts/CommonDialog.js")" type="text/javascript"></script>
      <link rel="stylesheet" href="@Url.Content("~/Content/themes/cupertino/jquery-ui-1.10.4.custom.css")">
<script>
    $(document).ready(function () {

        confirmDlg = $("#dialog-confirm").dialog(
         {
             resizable: false,
             autoOpen: false,
             modal: true
   
         });

        errorDlg = $("#dialog-error").dialog(
           {
               width: 450,
               resizable: false,
               autoOpen: false,
               modal: true,
               buttons: {
                   "OK": function ()
                   {
                       $(this).dialog("close");
                       redirect();
                   }


               }
           });

        infoDlg = $("#dialog-info").dialog(
         {
             width: 450,
             resizable: false,
             autoOpen: false,
             modal: true,
             buttons: {
                 "OK": function ()
                 {

                     $(this).dialog("close");
                     redirect();
                 }
             }
         });

        
@if (!String.IsNullOrEmpty(ViewBag.InfoMsg))
{
  <text>
        showInfoDlg();
   </text>
}
@if (!String.IsNullOrEmpty(ViewBag.ErrorMsg))
{
    <text>
        showErrorDlg();
    </text>
}



        addConfirmListener();
    });

    function addConfirmListener() {
        $("[need-confirm]").click(function (event)
        {
            var btnName = $(this).attr('name');
            var message = $(this).attr('confirm-text');
            event.preventDefault();
            return showConfirmDefault(message, btnName);
        });
    }

    function redirect()
    {
        var url = "@ViewBag.ReDirectUrl";
        if(url!='null' &&  url!='')
        {
           window.location.href = url;
        }
    }
</script>



<div id="dialog-confirm" title="Confirm">
      <div  style="padding: 0 .7em;">
       <p>
            <img src="@Url.Content("~/Content/themes/cupertino/images/Help.png")" />
             <span id="contentConfirm" style="font-size:medium">ยืนยัน ? </span>
        </p>
      </div>
</div>




<div  id="dialog-error" title="Error">
    <div style="padding: 0 .7em;">
        <p>
            <img src="@Url.Content("~/Content/themes/cupertino/images/Error.png")" />
            <span id="contentError" style="font-size:medium;color:red"> @ViewBag.ErrorMsg</span>
           
        </p>
    </div>
</div>

<div  id="dialog-info" title="Info">
    <div style="padding: 0 .7em;">
        <p>
            <img src="@Url.Content("~/Content/themes/cupertino/images/Info.png")" />
            <span id="contentInfo" style="font-size:medium"> @ViewBag.InfoMsg</span>
        </p>
    </div>
</div>

